<meta charset="UTF-8">
<div class="content-wrapper" style="min-height: 946px;">
    <!-- Main content -->
    <section class="content">
    	<div class="box box-default">
	     <div class="box-body">
          <div class="row">
           <!--<div class="col-md-3">
          <div class="box box-default box-solid" >
            <div class="box-header with-border btn">
              <h3 class="box-title" ng-click="showAllDept()">战车餐饮管理公司</h3>
			  <div class="box-tools pull-right">
                <button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i>
                </button>
              </div>
             
            </div>
           
            <div class="box-body" style="max-height: 400px;overflow: auto;">
              <ul class="nav nav-stacked">
                <li ><a href="" ng-repeat="dept in depts" ng-click="searchSonDept(dept.id)" style="text-align: center;"><i class="fa fa-circle pull-left"></i>&nbsp;{{dept.name}}</a></li>
              </ul>
            </div>
           
          </div>
       
        </div>-->
            <!-- /.col -->
            <div class="col-md-12">
              	<div class="box" style="border-top: 0px;box-shadow: none;">
            <div class="box-header" >
              <h3 class="box-title">Table</h3>

              <div class="box-tools">
                <div class="input-group input-group-sm" style="width: 100%;">
                  <input type="text" name="table_search" class="form-control pull-right" placeholder="输入组织机构名称、编码" ng-model="searchAccording"  autocomplete="off">

                  <div class="input-group-btn">
                    <button type="submit" class="btn btn-default" ng-click="saerchDept()" ><i class="fa fa-search"></i></button>
                  </div>
                </div>
              </div>
            </div>
            <!-- /.box-header -->
            <div class="box-body table-responsive no-padding" style="overflow-y: auto;height: 300px;">
              <table class="table table-hover">
                <tbody>
                <tr>
                  <th>编码</th>
                  <th>名称</th>
                  <th>操作</th>
                </tr>
                <tr ng-repeat="sonDept in sonDepts| orderBy: 'code'">
                  <td>{{sonDept.code}}</td>
                  <td class="dept_name" data-name="{{sonDept.Name}}">{{sonDept.name}}</td>
                  <td>
                  	<a href="" class="btn btn-lg edit" style="padding:0px" title="修改" ng-click="edit(sonDept.id)"><i class="fa fa-edit"></i></a>
                  	<a href="" class="btn btn-lg del" style="padding:0px" title="删除" ng-click="del(sonDept.name,sonDept.id)"><i class="fa  fa-close"></i></a>
                  </td>
                </tr>
               </tbody>
              </table>
            </div>
            <!-- /.box-body -->
            <div class="clearfix" style="padding: 10px;">
            <!-- 调出模态框 -->
            	<button type="button" class="btn btn-success col-md-2 col-md-offset-5 btn-lg"  id="modalBtn" data-toggle="modal" data-target="#newDept"><i class="fa fa-plus pull-left" style="margin-top:3px;"></i>添加组织机构</button>
            </div>
          </div>
            </div>
            <!-- /.col -->
          </div>
          <!-- /.row -->
        </div>
        <!-- /.box-body -->
      </div>
      
    </section>
    <!-- /.content -->
  </div>
<!-- 模态框添加组织结构 -->
<div class="modal fade" id="newDept" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header" title="可拖动">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title" id="myModalLabel" style="text-align:center">新增组织机构</h4>
      </div>
      <form class="form-horizontal">
      <div class="modal-body form-horizontal">
       
       <div class="box-body">
       				<div class="form-group">
                        <label class="col-sm-2 control-label">部门编码</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" placeholder="部门编码" ng-model="newdept[0].code" ng-required="true">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="inputEmail3" class="col-sm-2 control-label">部门名称</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" placeholder="部门名称" ng-model="newdept[0].name" ng-required="true">
                        </div>
                    </div>
                    <!--<div class="form-group">
                    <label class="col-sm-2 control-label">部门类型</label>
                        <div class="col-sm-10">
                            <input type="radio" id="outdept" class="chk_1 depttype" name="depttype" value="1" ng-model="newdept[0].type"/>
							<label for="outdept" class="checklable"></label>外部部门
                        <input type="radio" id="indept" class="chk_1 depttype" name="depttype" value="0" ng-model="newdept[0].type"/>
							<label for="indept" class="checklable"></label>内部部门
                        </div>
                    </div>-->
                </div>
      </div>
      
      <div class="modal-footer">
        <button type="button" class="btn btn-default btn-lg pull-left" data-dismiss="modal">取消</button>
        <button type="submit" class="btn btn-success btn-lg" ng-click="saveNewDept();">保存</button>
      </div>
      </form>
    </div>
  </div>
</div>
<!-- end modal1 -->
<!-- 模态框 删除组织结构 -->
<div class="modal fade" id="delDept" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" >
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title" style="text-align:center">提示</h4>
      </div>
      <div class="modal-body form-horizontal">
        <div class="box-body">
           	确定要删除组织结构<b class="delname"></b>吗？
           	<b id="deldeptId" class="hidden"></b>
        </div>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default btn-lg pull-left" data-dismiss="modal">取消</button>
        <button type="button" class="btn btn-success btn-lg" ng-click="del_dept();">确定</button>
      </div>
    </div>
  </div>
</div>
<!-- 模态框 修改组织结构 -->
<div class="modal fade" id="editDept" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" >
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title" style="text-align:center">修改组织机构</h4>
      </div>
      <from>
      <div class="modal-body form-horizontal">
        <div class="box-body">
        			<div class="form-group">
                        <label class="col-sm-2 control-label">部门编码</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" ng-model="editdept[0].code" > 
                             <span style="color: red;" ng-show="editdept[0].code==''"><i class="fa fa-close"></i>部门名称不能为空</span>
                        </div>
                    </div>
           	  		<div class="form-group">
                        <label for="inputEmail3" class="col-sm-2 control-label">部门名称</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" ng-model="editdept[0].name" >
                            <span style="color: red;" ng-show="editdept[0].name==''"><i class="fa fa-close"></i>部门名称不能为空</span>
                        </div>
                    </div>
                    
                    <!--<div class="form-group">
                    <label class="col-sm-2 control-label">部门类型</label>
                        <div class="col-sm-10">
                            <input type="radio" id="editout" class="chk_1" name="edittype" value="1" ng-model="editdept[0].type"/>
							<label for="editout" class="checklable"></label>外部部门
                        <input type="radio" id="editin" class="chk_1" name="edittype" value="0" ng-model="editdept[0].type"/>
							<label for="editin" class="checklable"></label>内部部门
                        </div>
                    </div>-->
         </div>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default btn-lg pull-left" data-dismiss="modal">取消</button>
        <button type="submit" class="btn btn-success btn-lg" ng-click="edit_dept();">确定</button>
      </div>
      </from>
    </div>
  </div>
</div>
